package com.lxx.wiki.controller;

import com.lxx.wiki.domain.req.UserLoginReq;
import com.lxx.wiki.domain.resp.CommonResp;
import com.lxx.wiki.service.LoginService;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {

    @Autowired
    private LoginService loginService;


    @PostMapping("/login")
    public CommonResp login(@Valid @RequestBody UserLoginReq req) {
        return loginService.login(req);

    }

    @GetMapping("/logout")
    public CommonResp logout() {
        return loginService.logout();
    }
}
